#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void solve() {
  ll n, m, k;
  cin >> n >> m >> k;
  vector<vector<ll>> v(n, vector<ll>(m));
  vector<ll> row(n, 0);
  vector<ll> col(m, 0);
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < m; j++) {
      cin >> v[i][j];
      row[i] += v[i][j];
      col[j] += v[i][j];
    }
  }
  k = min(k, n + m);
  for (int mask = 0; mask < (1 << n); mask++) {
    int r = __builtin_popcount(mask);
    if (r > k) continue;
    int c = min(k - r, m);
    ll srow = 0;
    vector<ll> temp = col;
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        srow += row[i];
        for (int j = 0; j < m; j++) {
          temp[j] -= v[i][j];
        }
      }
    }
    sort(temp.rbegin(), temp.rend());
    ll scol = 0;
    for (int j = 0; j < c; j++) {
      scol += temp[j];
    }
    ans = max(ans, srow + scol);
  }
  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}